export const btnType: Record<number, string> = {
  0: '缓存',
  1: '隐藏',
  2: '显示面包屑',
  3: '隐藏Tab',
  4: '携带参数',
  5: '隐藏全部子菜单',
  6: '固定Tab',
};
// 表格列类型
export interface RowType {
  address: string;
  age: number;
  id: number;
  name: string;
  nickname: string;
  role: string;
  parentId?: null | number;
}
// 基础元数据接口
// 基础元数据接口
interface MenuMeta {
  title: string;
  icon: string;
  hideMenu: boolean;
  hideBreadcrumb: boolean;
  ignoreKeepAlive: boolean;
  hideTab: boolean;
  frameSrc: string;
  carryParam: boolean;
  hideChildrenInMenu: boolean;
  affix: boolean;
  dynamicLevel: number;
  realPath: string;
}

// 菜单类型枚举
enum MenuType {
  /**
   * 目录
   */
  DIR = 1,
  /**
   * 菜单项
   */
  MENU = 2,
  /**
   * 页面元素
   */
  PAGEDOM = 3,
}
export const MenuTypeMap = {
  [MenuType.DIR]: '目录',
  [MenuType.MENU]: '菜单',
  [MenuType.PAGEDOM]: '页面元素',
};

// 服务名称枚举
enum ServiceName {
  CORE = 'Core',
  JOB = 'Job',
}

// 菜单项接口
interface MenuItem {
  id?: number;
  createdAt?: number;
  updatedAt?: number;
  trans?: string;
  level?: number;
  parentId?: null | number; // 1000000表示根节点
  path?: string;
  name: string;
  redirect: string;
  component: string;
  sort: number;
  disabled: boolean;
  menuType: MenuType;
  serviceName: ServiceName;
  permission: string;
  title: string;
  icon: string;
  /**
   * true:显示
   * false:隐藏
   */
  hideMenu?: boolean;
  hideBreadcrumb?: boolean;
  ignoreKeepAlive?: boolean;
  hideTab?: boolean;
  frameSrc?: string;
  carryParam?: boolean;
  hideChildrenInMenu?: boolean;
  affix?: boolean;
  dynamicLevel?: number;
  realPath?: string;
  children?: MenuItem[]; // 可选子菜单
  [key: string]: any;
}

// 菜单列表类型
type MenuList = MenuItem[];

// 导出所有类型
export type { MenuItem, MenuList, MenuMeta };
export { MenuType, ServiceName };
